﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PRJ_LDW_Eutoliso.AccountAdmin.Servico.Categoria
{
    public partial class Insert : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnCancelar_Click(object sender, EventArgs e)
        {
            Response.Redirect("Home.aspx");
        }

        protected void btnInserir_Click(object sender, EventArgs e)
        {
            try
            {
                using (eutolisodbEntities1 context = new eutolisodbEntities1())
                {
                    servicotipo set = new servicotipo();

                    set.Nome = txtNome.Text;
                    set.Observacao = txtObservacao.Text;

                    context.servicotipo.Add(set);
                    context.SaveChanges();

                    //lblMsg.Text = "Item inserido com sucesso!";
                    lblMsg.Visible = true;

                }

            }
            catch (Exception)
            {

                lblMsg.Visible = true;
                lblMsg.Text = "Ocorreu um problema ao inserir o item.";
                //throw;
            }
        }
    }
}